/**
 * 
 */
package com.macasa.panel.exception;

/**
 * Class DAOException
 * <P>
 * 
 * @author Mickaël Husson
 * @date 12 septembre 2011
 */
public class DAOException extends Exception {

	/** The Constant serialVersionUID. */
	private static final long	serialVersionUID	= 4893156885236645539L;

	/**
	 * The Enum ERROR_CODE.
	 */
	public static enum ERROR_CODE {

		/** A create/update error. */
		CREATE_UPDATE,

		/** A delete error. */
		DELETE,

		/** A read error. */
		READ,

		/** A session error */
		SESSION
	}

	/** The code. */
	private final ERROR_CODE	code;

	/**
	 * Default constructor.
	 * 
	 * @param throwable
	 *            the nested exception
	 * @param code
	 *            the error type code
	 */
	public DAOException(final Throwable throwable, final ERROR_CODE code) {
		super(throwable);
		this.code = code;
	}

	/**
	 * Gets the error type code.
	 * 
	 * @return the error code
	 */
	public ERROR_CODE getCode() {
		return this.code;
	}
}
